import { Navigate, useRoutes } from "react-router-dom";
import { lazy } from "react";
import Load from "../components/Load";
const Home = lazy(() => import("../pages/home"));
const Login = lazy(() => import("../pages/login"));
const Page1 = lazy(() => import("../pages/home/page1"));
// 课程管理
const Graphic = lazy(() => import("../pages/home/course/graphic"));
const Video = lazy(() => import("../pages/home/course/video"));
const Audio = lazy(() => import("../pages/home/course/audio"));
const GrapEdit = lazy(() => import("../pages/home/course/graphicjump"));
const EditVideo = lazy(() => import("../pages/home/course/videojump/EditVideo")
);
const EditAdvio = lazy(() => import('../pages/home/course/audiojump/audioedit'))
// 新建
const Grapxinjian = lazy(() => import('../pages/home/course/addgraphic/xinjianGraphic'))
const Videoxinjian = lazy(() => import('../pages/home/course/addvideo/addvideo'))
const Audioxinjian = lazy(() => import('../pages/home/course/addaudio/AddAudio'))
// const TestTime = lazy(() => import('../pages/home/course/test/test'))
// 实物商品
const Goods = lazy(() => import('../pages/home/goods'))
const EditGoods = lazy(() => import('../pages/home/goods/editGoods'))
const AddGoods = lazy(() => import('../pages/home/goods/addGoods'))
//用户管理
//用户详情
const DescUser = lazy(() => import('../pages/home/user/query/descUser'))
//用户标签
const UserLable = lazy(() => import('../pages/home/user/userLable/'))
const AddUserLable = lazy(() => import('../pages/home/user/userLable/addUserLable'))
const EditUserLable = lazy(() => import('../pages/home/user/userLable/editUserLable'))
// 角色管理
const Query = lazy(() => import("../pages/home/user/query"));
const FreeMember = lazy(() => import("../pages/home/user/free-member"));
const PayMember = lazy(() => import("../pages/home/user/pay-member"));
const MemberInterests = lazy(() =>
  import("../pages/home/user/member-interests")
);
const IntegralRule = lazy(() => import("../pages/home/user/integralRule"));
const GrowthValue = lazy(() => import("../pages/home/user/growthValue"));
const Add_paymember = lazy(() => import('../pages/home/user/pay-member/add_paymember'))
const Membership_level = lazy(() => import('../pages/home/user/free-member/membership_level'))
const New_members = lazy(() => import('../pages/home/user/free-member/new_members'))
const Mod_paymember = lazy(() => import('../pages/home/user/pay-member/mod_paymember'))
const Add_memberinterests = lazy(() => import('../pages/home/user/member-interests/add_memberinterests'))
const Mod_memberinterests = lazy(() => import('../pages/home/user/member-interests/mod_memberinterests'))

// 订单
const Order = lazy(() => import("../pages/home/order"));
// 订单查询
const OrderSearch = lazy(() => import("../pages/home/order/orderSearch"));
// 订单详情
const OrderDetails = lazy(() => import("../pages/home/order/orderDetails"));
// 资产
const Assets = lazy(() => import("../pages/home/assets"));
// 营销管理
const Coupons = lazy(() => import("../pages/home/market/coupons"));
const CouponsAdd = lazy(() => import("../components/coupons_hx/couponsAdd"));
const CouponsDataPage = lazy(() => import("../components/coupons_hx/couponsDataPage"))
const TimeDiscount = lazy(() => import("../pages/home/market/time-discount"));
const FullReduct = lazy(() => import("../pages/home/market/full-reduct"));
// FullReduct的子页面 满X元减
const EditFullReact = lazy(() => import("../pages/home/market/full-reduct/edit-full-reduct"))
const NewFullReduct = lazy(() => import("../pages/home/market/full-reduct/new-full-reduct"))
//  满X元折活动
const NewFullReduct1 = lazy(() => import("../pages/home/market/full-reduct/new-full-reduct1"))
const NewFullReduct2 = lazy(() => import("../pages/home/market/full-reduct/new-full-reduct2"))
const NewFullReduct3 = lazy(() => import("../pages/home/market/full-reduct/new-full-reduct3"))
const Seckill = lazy(() => import("../pages/home/market/seckill"));
const Postage = lazy(() => import("../pages/home/market/postage"));
const NewPostage = lazy(() => import("../pages/home/market/postage/new-postage"));
const NewPostageEdit = lazy(() => import("../pages/home/market/postage/new-postage-edit"));
const FullGive = lazy(() => import("../pages/home/market/full-give"));
const NewFullGive = lazy(() => import("../pages/home/market/full-give/new-full-give"))
const SpellGroup = lazy(() => import("../pages/home/market/spell-group"));
const Combo = lazy(() => import("../pages/home/market/combo"));
const SceneMarket = lazy(() => import("../pages/home/market/sceneMarket"));
const SceneAdd = lazy(() => import("../pages/home/market/sceneMarket/sceneAdd"));
const SceneEdit = lazy(() => import("../pages/home/market/sceneMarket/sceneEdit"));
//新增限时
const DiscountAdd = lazy(() => import('../pages/home/market/time-discount/discountAdd/discountAdd'))
//编辑限时
const DiscountEdit = lazy(() => import('../pages/home/market/time-discount/discountEdit/discountEdit'))
// 设置
const BannerImg = lazy(() => import("../pages/home/setting/banner"));
//Banner子页面
const AboutBanner = lazy(() =>
  import("../pages/home/setting/banner/AboutBanner")
);
const OperationLog = lazy(() => import("../pages/home/setting/log"));
//个人信息
const Personal = lazy(() => import("../pages/home/setting/personal"));
const Role = lazy(() => import("../pages/home/setting/role"));

const AddRole = lazy(() => import("../pages/home/setting/role/addrole"))
const Staff = lazy(() => import("../pages/home/setting/staff"));
//员工管理子页面
const AboutStaff = lazy(() => import("../pages/home/setting/staff/AboutStaff"));

const Routes = () => {
  return useRoutes([
    {
      path: "/",
      element: <Navigate to="/login" />,
    },
    {
      path: "/login",
      element: Load(Login),
    },
    {
      path: "/home",
      element: Load(Home),
      children: [
        {
          //主页内容
          index: "index",
          element: Load(Page1),
        },
        // 课程
        {
          // 图文课程
          path: "course/graphic",
          element: Load(Graphic),
        },
        // 图文课程的编辑
        {
          path: "course/grapedit",
          element: Load(GrapEdit),
        },
        // 新建
        {
          path: 'course/graphicxinjian',
          element: Load(Grapxinjian)
        },
        {
          // 视频课程
          path: "course/video",
          element: Load(Video),
        },
        // 编辑视频课程的页面
        {
          path: "course/videoedit",
          element: Load(EditVideo),
        },
        // 新建
        {
          path: 'course/videoadd',
          element: Load(Videoxinjian)
        },
        {
          // 音频课程
          path: "course/audio",
          element: Load(Audio),
        },

        // 编辑音频课程的页面
        {
          path: 'course/advioedit',
          element: Load(EditAdvio)
        },
        {
          path: 'course/advioAdd',
          element: Load(Audioxinjian)

        },
        // 测试
        // {
        //   path: 'course/testtime',
        //   element: Load(TestTime)
        // },
        {
          // 实物商品
          path: "goods",
          element: Load(Goods),
        },
        {
          // 实物商品--修改商品管理
          path: "editGoods",
          element: Load(EditGoods),
        },
        {
          // 实物商品--增加商品管理
          path: "addGoods",
          element: Load(AddGoods),
        },
        {
          // 用户管理
          // 用户查询  
          path: "user/query",
          element: Load(Query),
        },
        {
          // 用户详情 
          path: "user/descUser",
          element: Load(DescUser),
        },
        {
          // 用户标签  
          path: "user/userLable",
          element: Load(UserLable),
        },
        {
          // 增加用户标签
          path: "user/addUserLable",
          element: Load(AddUserLable),
        },
        {
          // 编辑用户标签
          path: "user/editUserLable",
          element: Load(EditUserLable),
        },
        {
          // 免费会员等级管理
          path: "user/free-member",
          element: Load(FreeMember),
        },
        // 免费会员等级管理修改
        {
          path: 'user/Membership_level',
          element: Load(Membership_level)
        },
        // 免费会员等级管理新增
        {
          path: 'user/New_members',
          element: Load(New_members)
        },
        {
          // 付费会员卡管理
          path: "user/pay-member",
          element: Load(PayMember),
        },
        //付费会员新增
        {
          path: 'user/Add_paymember',
          element: Load(Add_paymember)
        },
        //付费会员修改
        {
          path: 'user/Mod_paymember',
          element: Load(Mod_paymember)
        },
        {
          // 会员权益
          path: "user/member-interests",
          element: Load(MemberInterests),
        },
        //新增会员权益
        {
          path: 'user/Add_memberinterests',
          element: Load(Add_memberinterests)
        },
        //会员权益修改
        {
          path: 'user/Mod_memberinterests',
          element: Load(Mod_memberinterests)
        },
        {
          // 积分规则
          path: "user/integralRule",
          element: Load(IntegralRule),
        },
        {
          // 成长值规则
          path: "user/growthValue",
          element: Load(GrowthValue),
        },
        {
          // 订单管理
          breadcrumb: "订单管理",
          path: "order",
          element: Load(Order),
          children: [
            // {
            //   breadcrumb: "订单查询",
            //   index: "index",
            //   element: Load(OrderSearch),
            // },
            // 订单查询
            {
              breadcrumb: "订单查询",
              path: "search",
              element: Load(OrderSearch),
            },
            // 订单详情
            {
              breadcrumb: "订单详情",
              path: "details",
              element: Load(OrderDetails),
            },
          ],
        },
        {
          // 资产管理
          path: "assets",
          element: Load(Assets),
        },
        {
          // 营销管理
          // 优惠券
          path: "market/coupons",
          element: Load(Coupons),
        },
        {
          path: "market/couponsAdd",
          element: Load(CouponsAdd)
        },
        {
          path: "market/couponsDataPage",
          element: Load(CouponsDataPage)
        },
        {
          // 限时折扣
          path: "market/time-discount",
          element: Load(TimeDiscount),
        },
        {
          // 新增限时折扣
          path: "market/time-discount/discountAdd",
          element: Load(DiscountAdd),
        },
        {
          // 限时编辑
          path: "market/time-discount/discountEdit",
          element: Load(DiscountEdit),
        },
        {
          // 满减满折
          path: "market/full-reduct",
          element: Load(FullReduct),
        },
        {
          // 新建满减X元减活动
          path: "market/full-reduct/new-full-reduct",
          element: Load(NewFullReduct),
        },
        {
          // 编辑满减X元减活动
          path: "market/full-reduct/edit-full-reduct",
          element: Load(EditFullReact),
        },

        {
          // 满减X元折活动
          path: "market/full-reduct/new-full-reduct1",
          element: Load(NewFullReduct1),
        },
        {
          // 满减X元折活动
          path: "market/full-reduct/new-full-reduct2",
          element: Load(NewFullReduct2),
        },
        {
          // 满减X元折活动
          path: "market/full-reduct/new-full-reduct3",
          element: Load(NewFullReduct3),
        },
        {
          // 秒杀
          path: "market/seckill",
          element: Load(Seckill),
        },
        {
          // 满包邮
          path: "market/postage",
          element: Load(Postage),
        },
        {
          // 满包邮新建
          path: "market/postage/new-postage",
          element: Load(NewPostage),
        },
        {
          // 满包邮
          path: "market/postage/new-postage-edit",
          element: Load(NewPostageEdit),
        },
        {
          // 满赠
          path: "market/full-give",
          element: Load(FullGive),
        },
        {
          // 满赠新建
          path: "market/full-give/new-full-give",
          element: Load(NewFullGive),
        },

        {
          // 拼团
          path: "market/spell-group",
          element: Load(SpellGroup),
        },
        {
          // 套餐
          path: "market/combo",
          element: Load(Combo),
        },
        {
          // 场景营销
          path: "market/sceneMarket",
          element: Load(SceneMarket),
        },
        {
          //场景营销添加
          path: "market/sceneAdd",
          element: Load(SceneAdd)
        },
        {
          //场景营销修改
          path: "market/sceneEdit",
          element: Load(SceneEdit)
        },
        {
          // 设置
          // banner图管理
          path: "setting/banner",
          element: Load(BannerImg),
        },
        {
          //bannner子页面
          path: "setting/banner/aboutBanner",
          element: Load(AboutBanner),
        },
        {
          // 员工管理
          path: "setting/staff",
          element: Load(Staff),
        },
        {
          //员工子页面
          path: "setting/staff/aboutStaff",
          element: Load(AboutStaff),
        },
        {
          // 角色管理
          path: "setting/role",
          element: Load(Role),
        },
        {
          // 角色管理新增
          path: "setting/role/addrole",
          element: Load(AddRole),
        },
        {
          // 操作日志
          path: "setting/log",
          element: Load(OperationLog),
        },
        {
          // 个人信息
          path: "setting/personal",
          element: Load(Personal),
        },
      ],
    },
  ]);
};

export default Routes;
